package com.ycxy.springbootmybatis.mapper;


import com.ycxy.springbootmybatis.entity.User;
import com.ycxy.springbootmybatis.entity.UserCommentDTO;
import com.ycxy.springbootmybatis.entity.UserDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface UserMapper {

    //查找用户
    User getUserById(Integer id);

    List<User> findAll();

    int insertUser(@Param("user") User user);

    int updateUser(@Param("user") User user);

    int deleteUser(Integer id);

    //根据邮箱和用户动态查询用户
    User getUserByNameOrEmail(@Param("user") User user);

    //根据id列表查询用户
    List<User> getUserByIds(@Param("ids") List<Integer> ids);

    //批量插入用户
    int insertManyUsers(@Param("users") List<User> users);

    //查询到用户与他的博客信息
    UserDTO findUserBlogById(@Param("id") Integer id);

    //查询到用户与他的评论信息
    List<UserCommentDTO> findByUserCommentById(@Param("id") Integer id);
}
